<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * 用户管理的控制器
 */
class Sell extends CI_Controller {
	public function __construct()
	  {
	    parent::__construct();
	    
	    if(empty($_SESSION['id'])){
	      echo "0";
	      echo "<script src='/static/js/jquery.min.js?v=2.1.4'></script>";
	      echo "<script src='/static/js/layer/layer.js'></script>";
	      echo "<script>layer.msg('你还没有登录，请先登录',{icon:2});setTimeout(function(){window.location.href='/login';},1500)</script>";
	      exit;
	    }
	  }
	//添加进货的方法
	public function addSell(){
		$data = $this->input->post();
		$data['time'] = time();
		$data['operator'] = $_SESSION['name'];
		$data['checkout'] == 2?$data['is_payment']=2:$data['is_payment']=1;
		$data['is_ delivery'] = 1;

		if($this->sell->add($data)){
			$reg = array(
				"status"=>'success',
				"reson"=>"添加成功"
			);
		}else{
			$reg = array(
				"status"=>'error',
				"reson"=>"添加失败"
			);
		}
		jEcho($reg);
	}
}